package com.chixing.fourteen.service.impl;

import com.chixing.fourteen.Utils.MessageDigestUtil;
import com.chixing.fourteen.pojo.Customer;
import com.chixing.fourteen.repository.CustomerRepository;
import com.chixing.fourteen.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Y2014188432
 */
@Service
public class CustomerServiceImpl implements CustomerService {

    @Autowired
    private CustomerRepository customerRepository;

    @Override
    /**
     * 用户登录
     * 使用 MD5 加密
     */
    public Customer login(String username, String password) {
        password = MessageDigestUtil.getMessageDigest(password);
        return customerRepository.selectByNameAndPassword(username, password);
    }
}
